<?php
/*
 * LiveWebcast Multiple Language Controller
 * 
 * this file fills the template with data
 * 
 * @author : Jason Meulenhoff
 * @mail : mail@kacangboi.com
 * @web : http://kacangboi.com
 * @copyright : KacangNetworks 2010
 * 
 */
require_once "../../config.php";
isLogged();
sessionExpired();
readVideoDirectory();
$parser = new parser();

if(isBreadCrumbSessionSet())
		addToList(getCurrentPage());

if(getDisabled() != "TRUE")
{
	if(selectedEnviroment() == "BOTH")
	{
		header("Location: both_english.controller.php");
	}
	elseif(selectedEnviroment() == "ENGLISH")
	{
		$parser->loadTemplate("../templates/language/english.html");
		$parser->assignVar("DETAILS","".selectedUrl()."".selectedpb("ENGLISH")."");
	}
	elseif(selectedEnviroment() == "DUTCH")
	{
		$parser->loadTemplate("../templates/language/dutch.html");	
		$parser->assignVar("DETAILS","".selectedUrl()."".selectedpb("DUTCH")."");
	}
	else
	{
		header("Location: error.controller.php");
		exit;
	}
	
	$chat = new chat();
	$parser->assignVars(array("title","logo"),array(PAGE_TITLE,"images/logo.png",));
	$parser->assignVar("breadcrumb",displayBreadCrumb());
	$parser->assignVar("username","{$_SESSION['logged']['name']}");
	$parser->assignVar("menu",generateMenu());
	$parser->assignVar("date",date("d-m-Y"));
	$parser->assignVar("switch","");
	$parser->assignVar("chat_messages",$chat->readAllMessages());
	if($_SESSION['admin'] == true)
		$parser->assignVar("value","admin");
	else
		$parser->assignVar("value",$_SERVER['REMOTE_ADDR']);
	if(DISPLAY_FLOAT)
	{
		$parser->assignVar("script","<script type=\"text/javascript\" src=\"../js/floatingbar.js\"></script>");
		$parser->assignVar("message","<img src='../images/error.png'/> Application running in Development Mode");
	}
	else
		$parser->assignVar("script","");
	
	$parser->parse(true);
}
else
{
	header("Location: disabled.controller.php");
	exit;
}
?>